<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ include file="/pages/include.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
	<div align="center">
		<div class="easyui-layout" align="center" style="width:100%;height:100%;">
			<form id="addjpdl" style="margin-top: 50px;">
				<input id="addPriceId" type="hidden" name="priceId" value=""/>
				<input id="pricePhoneText" type="hidden" name="pricePhoneText" value=""/>
				<input id="priceDetailText" type="hidden" name="priceDetailText" value=""/>
				<input id="priceRepairText" type="hidden" name="priceRepairText" value=""/>
				<table>
					<tr>
						<td>手机品牌:</td>
						<td><input id="addPhoneType" name="pricePhoneId" class="easyui-combobox" data-options="required:true" />
						</td>
					</tr>
					<tr>
						<td>手机型号:</td>
						<td><input id="addDetailType" name="priceDetailId" class="easyui-combobox" data-options="required:true"/>
						</td>
					</tr>
					<tr>
						<td>损坏类型:</td>
						<td><input id="addRepairType" name="priceRepairId" class="easyui-combobox" data-options="required:true"/>
						</td>
					</tr>
					<tr>
						<td>维修价格:</td>
						<td><input id="addPrice" name="repairPrice" value=""/>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>

	<script type="text/javascript">
		$(document).ready(function(){
			//初始化工作流类型
			$("#addPhoneType").combobox({
				url: "<%=path%>/dictionary/getPhoneType",
				valueField : "id",
				textField : "text",
				panelHeight : "auto",
				required:true,    
			    multiple:false,
			    onSelect: function(rec){
			    	$("#pricePhoneText").val(rec.text);
		            loadDetailType(rec);   
		        },
		        onLoadSuccess: function(){
		        	if(operateObj.priceDetailId){
		        		$("#addPhoneType").combobox("select", operateObj.pricePhoneId);
		        	}
		        }
			});
			
			$("#addRepairType").combobox({
				url: "<%=path%>/common/loadDictCombobox?dictCode=repairType",
				valueField : 'dictDetailCode',
			    textField : 'dictDetailName',
			    panelHeight : "auto",
				required:true,    
			    multiple:false,
			    onSelect: function(rec){
			    	$("#priceRepairText").val(rec.dictDetailName);  
		        }
			});
			
			function loadDetailType(rec){
				$("#addDetailType").combobox({
					url: "<%=path%>/dictionary/getPhoneDetailType?dictId=" + rec.id,
					valueField : "id",
					textField : "text",
					panelHeight : "auto",
					required:true,    
				    multiple:false,
				    onSelect: function(rec){
				    	$("#priceDetailText").val(rec.text);  
			        },
			        onLoadSuccess: function(){
			        	if(operateObj.priceDetailId){
			        		$("#addDetailType").combobox("select", operateObj.priceDetailId);	
			        	}
			        }
				});
			}
			
			if(operateObj.pricePhoneId){
				$("#addPriceId").val(operateObj.pricePhoneId);
				$("#addPrice").val(operateObj.repairPrice);
				$("#addRepairType").combobox("select", operateObj.priceRepairId);
			}
		});
</script>
</body>
</html>
